﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
#if DOT_NET
using Microsoft.VisualStudio.TestTools.UnitTesting;
#else
using Microsoft.VisualStudio.TestPlatform.UnitTestFramework;
#endif
using StyleMVVM.DependencyInjection;
using StyleMVVM.UnitTests.TestClasses.EnrichObjects;

namespace StyleMVVM.UnitTests.DependencyInjection
{
	[TestClass]
	public class FluentEnrichTests
	{
		[TestMethod]
		public void EnrichSimpleService()
		{
			Bootstrapper bootstrapper = new Bootstrapper();

			bootstrapper.Container.Register<SimpleService>().As<ISimpleService>().
				EnrichWith((x, y, z) => new WrappedService((ISimpleService)z));

			bootstrapper.Start();

			ISimpleService simpleService = bootstrapper.Container.Locate<ISimpleService>();

			Assert.IsNotNull(simpleService);
			Assert.IsInstanceOfType(simpleService, typeof(WrappedService));

			Assert.AreEqual(200, simpleService.TestMethod());

			bootstrapper.Shutdown();
		}
	}
}
